home *** CD-ROM | disk | FTP | other *** search
- Path: Belgium.EU.net!news
- From: Philip Rademakers <philip@sonytel.be>
- Newsgroups: comp.lang.c++
- Subject: Templates & friends
- Date: Mon, 15 Apr 1996 11:07:11 +0200
- Organization: EUnet Belgium, Leuven, Belgium
- Message-ID: <317211BF.41C6@sonytel.be>
- NNTP-Posting-Host: sclera.sonytel.be
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.01 (X11; I; IRIX 5.3 IP22)
-
- Hi,
-
- Does anybody know how to declare a friend class that is one of the
- argument classes? I tried the following:
-
- class X {
- protected:
- X();
- };
-
- template<class T>
- class foo {
- private:
- T* _ptr;
- public:
- friend class T;
- foo() { _ptr = new T; }
- };
-
- The compiler (on SGI) complains that X::X() is not accessible ?
-
- Thanks in advance for your help.
- --
- Philip Rademakers Tel: +32 2 724 19 80
- Sony Telecom Europe Tel: +32 2 724 19 64 (direct)
- Sint Stevens Woluwestraat 55 Fax: +32 2 726 26 86
- 1130 Brussels - Belgium Email: philip@sonytel.be
-